<?php

namespace App\Http\Controllers\Admin;

use App\Config;
use App\Frame;
use App\Product;
use App\Artist_category;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Storage;
use Symfony\Component\Yaml\Tests\A;
use Illuminate\Http\Response;
use App\Configs;

class ConfigController extends Controller
{
    //进入配置页
    public function index()
    {
        #获取热门信息
        $hot = Config::first();

        return view('admin.config.index',['hot'=>$hot]);
    }
    //设置热门信息
    public function setHot()
    {
        $map = Config::where('id',1)->update([
           'title' => Input::get('title'),
           'telephone' => Input::get('telephone'),
           'address' => Input::get('address'),
           'email' => Input::get('email'),
           'hot1' => Input::get('hot1'),
           'hot2' => Input::get('hot2'),
           'hot3' => Input::get('hot3'),
           'hot4' => Input::get('hot4'),
           'hot5' => Input::get('hot5'),
           'hot6' => Input::get('hot6'),
           'hot7' => Input::get('hot7'),
           'hot8' => Input::get('hot8'),
        ]);
        if($map){
            return back()->with('msg','设置成功！');
        }else{
            return back()->withErrors('设置失败！');
        }
    }
}
